
#pragma once

 #include "BaseEditor.h"
 #include "NodeEditor.h"
 #include "OgitorsRoot.h"
 #include "../../Dependencies\Ogre\PlugIns\ParticleUniverse_1_3\Plugins\ParticleUniverse\include\ParticleUniversePlugin.h"
#include "export.h"

namespace Ogitors
{

class PluginExport  CPuParticleEditor : public CNodeEditor
{
    friend class CPuParticleEditorFactory;
public:
	void					GetObjectUserData(std::ofstream &outfile);
    virtual void            GetObjectProperties(Ogre::NameValuePairList &retList);
	virtual void			SetHandle(void *objHandle,bool display);
	//virtual void			SetNodeHandle(void *objHandle,bool display);

    virtual bool			SetupPropertiesWnd();
	virtual void            FreeHandle();
    virtual void            ShowBoundingBox(bool bShow);
	virtual Ogre::AxisAlignedBox GetAABB();
    /// Overridden by Editor Objects to Import Object Dependant Properties
    virtual CBaseEditor    *Restore(Ogre::NameValuePairList &retList);
    /// Gets the Handle to encapsulated object
    inline virtual void    *GetHandle() {return static_cast<void*>(m_ParticleHandle);};
    /// Returns the Factory associated with this object
	static CBaseEditorFactory *GetFactory();
    /// Returns the Factory associated with this object can be overridden
	virtual CBaseEditorFactory *GetFactoryDynamic();
	virtual Ogre::String	GetMeshFileName() {return m_ParticleSystem;};

	virtual void	SetMeshFileName(int BIND_ID,Ogre::String val,bool refresh) ;

protected:
    ParticleUniverse::ParticleSystem *m_ParticleHandle;
	Ogre::String          m_ParticleSystem;

	CPuParticleEditor(Ogre::String typestring = "PuParticle Object", EDITORTYPE etype = ETYPE_PARTICLE);
	virtual     ~CPuParticleEditor() {};
	virtual bool HandleCustomFunction(int BIND_ID,Ogre::String val);
};

class PluginExport CPuParticleEditorFactory: public CBaseEditorFactory
{
public:
  CPuParticleEditorFactory() {};
  virtual ~CPuParticleEditorFactory() {};
  virtual CBaseEditor *CreateObject(CBaseEditor **parent, Ogre::NameValuePairList &params);
  virtual void DestroyObject(CBaseEditor *object){ object->FreeHandle();}
};

}
